package com.atwisdom.star.core.dao.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.atwisdom.star.core.dao.pojo.PlannerRelationInstance;
import com.atwisdom.star.core.dao.service.PlannerRelationInstanceService;
import com.atwisdom.star.core.dao.mapper.PlannerRelationInstanceMapper;
import org.springframework.stereotype.Service;

/**
* @author fushb
* @description 针对表【planner_relation_instance】的数据库操作Service实现
* @createDate 2023-03-30 14:27:39
*/
@Service
public class PlannerRelationInstanceServiceImpl extends ServiceImpl<PlannerRelationInstanceMapper, PlannerRelationInstance>
    implements PlannerRelationInstanceService{
    @Override
    public int realDelete(QueryWrapper<PlannerRelationInstance> wrapper){
        return this.baseMapper.realDelete(wrapper);
    }

    /**
     * 同步更新实例类名称
     * @param sourceClassName 原类名
     * @param newClassName 新类名
     * @return 返回结果
     */
    @Override
    public int updateClassName(String sourceClassName, String newClassName) {
        QueryWrapper<PlannerRelationInstance> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("className", sourceClassName);
        PlannerRelationInstance plannerRelationInstance = new PlannerRelationInstance();
        plannerRelationInstance.setClassName(newClassName);
        return this.baseMapper.update(plannerRelationInstance, queryWrapper);
    }
}




